package ScoreBoard.Login.Controller;

import ScoreBoard.Login.View.*;
import ScoreBoard.Login.Model.*;
import ScoreBoard.ScoreBoardMainFrame.ScoreBoardMainFrameView.*;
import ScoreBoard.ScoreBoardMainFrame.ScoreBoardMainFrameModel.*;
import ScoreBoard.ScoreBoardMainFrame.ScoreBoardMainFrameController.*;

public class ScoreBoardLoginController 
{
    public void initialize()
    {
    	getView().exitButton.addActionListener(new ExitButtonListener(getView(), getModel()));
    	getView().loginButton.addActionListener(new LoginButtonListener(getView(), getModel(), this));
    	getView().loadFileButton.addActionListener(new LoadFileButtonListener(getView(), getModel()));
    }
    public void setViewAndModel(ScoreBoardLoginView view, ScoreBoardLoginModel model)
    {
    	this.view = view;
    	this.model = model;
    }
    
    public ScoreBoardLoginView getView()
    {
    	return this.view;
    }
    public ScoreBoardLoginModel getModel()
    {
    	return this.model;
    }
    
    public void runMainFrame()
    {
    	this.view.frame.setVisible(false);
    	ScoreBoardMainFrameView scoreBoardMainFrameView = new ScoreBoardMainFrameView();
    	ScoreBoardMainFrameModel scoreBoardMainFrameModel = new ScoreBoardMainFrameModel();
    	ScoreBoardMainFrameController scoreBoardMainFrameController = new ScoreBoardMainFrameController();
    	scoreBoardMainFrameModel.setViewAndController(scoreBoardMainFrameView, scoreBoardMainFrameController);
    	scoreBoardMainFrameController.setViewAndModel(scoreBoardMainFrameView, scoreBoardMainFrameModel);
    	scoreBoardMainFrameModel.initialize();
    	scoreBoardMainFrameController.initialize();
    }
    
    private ScoreBoardLoginView view;
    private ScoreBoardLoginModel model;
}
